# -*- utf-8 -*-
from datetime import datetime

from celery import shared_task

from apps.help.models import ReportTempImage
from config import Aliyun
from utils import AliyunUtil


@shared_task
def delete_report_temp():
    """
    清空临时图片
    :return:
    """
    temps = ReportTempImage.objects.filter(out_time__lte=datetime.now()).values('filename')
    open('a.txt', 'w')
    AliyunUtil.delete_img(Aliyun.BUCKET, [n.filename for n in temps])
